﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bzure.Common.Core
{
    public interface IEntity
    {

    }
    /// <summary>
    /// 持久化状态接口
    /// </summary>
    public interface IPersistenceState
    {
        bool IsPersisted();
        /// <summary>
        /// 标记对象是否已经被持久化,调用该方法请慎重,可能会导致对象跟实际数据状态不一致.
        /// </summary>
        /// <param name="IsPersisted"></param>
        /// <returns></returns>
        IPersistenceState MarkPersistenceState(bool IsPersisted);
    }
    [Serializable]
    public class Entity : IEntity, IPersistenceState
    {
        public Entity()
        {
        }
        #region IPersistenceState
        bool _isPersisted = false;
        public bool IsPersisted()
        {
            return _isPersisted;
        }
        public IPersistenceState MarkPersistenceState(bool IsPersisted)
        {
            _isPersisted = IsPersisted;
            return this;
        }
        #endregion
    }
    /// <summary>
    /// 模板实体
    /// </summary>
    [Serializable]
    public class TemplateEntity : Entity
    {
    }
}
